package cn.com.demo.tp40.service.Impl;

import cn.com.demo.tp40.mapper.MainMapper;
import cn.com.demo.tp40.service.MainService;
import cn.com.demo.tp40.service.feign.FeignService;
import com.codingapi.txlcn.tc.annotation.LcnTransaction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Transactional
@Service
public class MainServiceImpl implements MainService {
    @Autowired
    private FeignService feignService;
    @Autowired
    private MainMapper mapper;
    @Override
    @Transactional
    @LcnTransaction
    public int deleteById(int id) {
        int num = -1;
      boolean is =  this.feignService.deletebyid(id);
      if (is){
          num = this.mapper.deleteById(id);
          return num;
      }else{
          return num;
      }

    }
}
